//
//  SmsCloudWebController.m
#import "SmsCloudWebController.h"
#import <WebKit/WebKit.h>
#import "SmsCloudMainNavView.h"
@interface SmsCloudWebController ()
@property (nonatomic,strong) SmsCloudMainNavView * smsCloudWebNavView;
@property (nonatomic, strong) WKWebView *smsCloudWebView;
@property (nonatomic,strong) UILabel * smsCloudNavTitleLab;
@end

@implementation SmsCloudWebController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = true;
    [self smsCloudInitView];
    [self smsCloudUpdataWebUrl];
}
- (SmsCloudMainNavView *)smsCloudWebNavView{
    if(!_smsCloudWebNavView){
        __weak __typeof__(self) weakSelf = self;
        _smsCloudWebNavView = [[SmsCloudMainNavView alloc] init];
        _smsCloudWebNavView.SmsCloudMainBackBlock = ^{
            [weakSelf.navigationController popViewControllerAnimated:true];
        };
    }
    return _smsCloudWebNavView;
}
- (void)smsCloudInitView{
    _smsCloudWebView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:[[WKWebViewConfiguration alloc] init]];
    _smsCloudWebView.scrollView.backgroundColor = UIColor.clearColor;
    _smsCloudWebView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    [self.view addSubview:_smsCloudWebView];
    [_smsCloudWebView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
    }];
    
    [self.view addSubview:self.smsCloudWebNavView];
    [self.smsCloudWebNavView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.right.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.top.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.height.equalTo(@([SmsCloudHead SmsCloudScreewRatio:88] + [SmsCloudHead SmsCloudTopSafeH]));
    }];
}
- (void)smsCloudUpdataWebUrl{
    if(_smsCloudWebUrl.length > 0){
        NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:_smsCloudWebUrl]];
        [self.smsCloudWebView loadRequest:request];
    }
}
- (void)wdjBack{
    [self.navigationController popViewControllerAnimated:true];
}
@end
